#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10,M=35;
const double down=0.996;
int n,L,her,ans,res,now,a[N],b[N];
vector<int>ned;
mt19937 g(time(0));
void fire(int p)
{
	double t=5000;
	int x,Mx,now1=a[p],now2=b[p];
	for(;t>=1e-12;t*=down)
	{
		ned.clear();
		for(int i=0;i<her;i++)
		{
			x=g()%n+1;
			now1^=a[x],now2^=b[x];
			ned.push_back(x);
		}
		if(now2>ans&&now1<=L) ans=now2;
		else
			if(exp((now2-ans)/t)<1.0*rand()/RAND_MAX)
			{
				for(int v:ned) now1^=a[v],now2^=b[v];
			}
	}
}
int main()
{
	freopen("lock.in","r",stdin);
	freopen("lock.out","w",stdout);
	scanf("%d%d",&n,&L);
	for(int i=29;~i;i--)
		if(L>>i&1) {her=i+1;break;}
	for(int i=0;i<n;i++)
		scanf("%d%d",a+i,b+i);
	if(n<=18)
		for(int i=0;i<(1<<n);i++)
		{
			now=res=0;
			for(int j=0;j<n;j++)
				if(i>>j&1) now^=a[j],res^=b[j];
			if(now<=L) ans=max(ans,res);
		}
	else
	{
		int k=2e8/((her+7)*9019)+100;
		for(int i=1;i<=k;i++) fire(i%n+1);
		if(n<=2e3)
			for(int i=1;i<=n;i++)
				for(int j=i;j<=n;j++)
					if((a[i]^a[j])<=L) ans=max(ans,b[i]^b[j]);
	}
	printf("%d\n",ans);
	fclose(stdin);fclose(stdout);
	return 0;
}
